<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>EXAMPLE</title>
</head>

<body>

<h1 align="left"><u>EXAMPLE</u></h1>

<p align="left"><font size="5">Taylor series are not born spontaneously, the initial condition 
of one's code must be initialized as a Taylor Series. For example, suppose we 
want to expand the sine function to 5th order in some variable x around x=<font face="Symbol">p</font>/6.&nbsp;
</font>
</p>
<p align="left"><b>The following code will <font color="#FF0000">not</font> 
work:</b></p>
<p align="left"><b><font face="Courier" color="#008000">PROGRAM DIFF_COSINE<br>
USE POLYMORPHIC_COMPLEXTAYLOR<br>
TYPE(TAYLOR) X,COSX,DSINX<br>
<br>
CALL INIT(NO1=3,NV1=1)<br>
<br>
CALL ALLOC(X,COSX,DSINX)<br>
<br>
X=PI/6.0_DP+(1.0_DP.MONO.'1') <br>
<br>
<br>
COSX=COS(X)<br>
<br>
DSINX=SIN(X).<a href="../i_tpsa.htm#d" style="text-decoration: none">D</a>.1<br>
<br>
</font><font face="Courier" color="#FF0000">CALL PRINT(COSX,6)&nbsp;&nbsp; </font><font face="Courier" color="#008000">
! Output</font><font face="Courier" color="#FF0000"><br>
CALL PRINT(DSINX,6)&nbsp; </font><font face="Courier" color="#008000">! Output</font><font face="Courier" color="#FF0000"><br>
</font><font face="Courier" color="#008000">
<br>
CALL KILL(X,COSX,DSINX)<br>
<br>
END PROGRAM DIFF_COSINE</font></b></p>
<p align="left"><b><br>
<font color="#FF0000" face="Courier">OUTPUT from the print command </font></b></p>
<p align="left"><b><font color="#FF00FF" face="Courier">&nbsp;etall 1, NO = 3, 
NV = 1, INA = 15<br>
*********************************************<br>
<br>
I COEFFICIENT ORDER EXPONENTS<br>
NO = 3 NV = 1<br>
0 0.8660254037844387 0<br>
1 -0.4999999999999999 1<br>
2 -0.4330127018922194 2<br>
</font><i><font color="#0033CC" face="Courier" size="4">3 0.8333333333333333E-01 3</font></i><font color="#FF00FF" face="Courier"><br>
-4 0.000000000000000 0<br>
<br>
etall 1, NO = 3, NV = 1, INA = 16<br>
*********************************************<br>
<br>
I COEFFICIENT ORDER EXPONENTS<br>
NO = 3 NV = 1<br>
0 0.8660254037844387 0<br>
1 -0.4999999999999999 1<br>
2 -0.4330127018922194 2<br>
-3 0.000000000000000 0</font></b></p>
<p align="left"><b><font face="Courier" color="#FF00FF">QUESTION: Explain the 
presence of an extra term  </font><font face="Courier" color="#0033CC"><i>in blue 
italic</i></font><font face="Courier" color="#FF00FF"> (cos(x)</font><font face="Symbol" color="#FF00FF"> </font><font face="Courier" color="#FF00FF">
and dsinx should be identical in the above code): 
why? <a target="_blank" href="answer_d.htm">Answer</a></font></b></p>
<p align="left">&nbsp;</p>

</body>

</html>